#!/usr/bin/env python

from test0 import *

def callback(sender):
  sender.set_text ("clicked")
  print "clicked"

class Window (Widget):
  def __init__(self):
    Widget.__init__(self, WidgetInd("window"))

class Button(Widget):
  click_num = 0
  def __init__(self):
    Widget.__init__(self, WidgetInd("button"))

  def set_text(self, text):
    self.set_arg (WidgetArg("set",
      [
      ("text", text)
      ]))

class Application:
  w = Window()
  b = Button()

  def __init__(self):
    init()
    self.w.create()
    self.b.create()
    self.b.set_text("hello")
    self.b.set_callback("sender", callback)

  def run(self):
    self.w.realize()
    main_loop()

if __name__ == "__main__":
  a = Application()
  a.run()

